package com.jxb.myshop.dao.impl;

import com.jxb.myshop.dao.GoodsTypeDao;
import com.jxb.myshop.entity.Type;
import com.jxb.myshop.util.DBUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

public class GoodsTypeDaoImpl implements GoodsTypeDao {
    private QueryRunner qr = new QueryRunner(DBUtil.getDs());

    @Override
    public List<Type> getAll() throws SQLException {
        return qr.query("select * from type", new BeanListHandler<>(Type.class));
    }
}
